In QuickTime 3, sequence grabber channel components can capture data into multiple files. Capturing to multiple files can improve the performance and flexibility of captures and enable larger total captures.
You can create a sequence grabber component that can capture to multiple files by doing the following in your sequence grabber component:
An example of how to do this is shown in Listing 8-1 . This example also shows how to use the SGAddOutputDataRefToMedia helper routine to easily manage the multiple files in which the captured data is stored.
Listing 1 Channel capture and managing multiple output files
Track aTrack = NewMovieTrack(theMovie, width, height, 0);
Media aMedia = NewTrackMedia(aTrack, TextMediaType,
kMediaTimeScale, nil, 0);
SeqGrabExtendedFrameInfo fi;
SGOutput lastOutput = nil;
long i;
OSErr err;
fi.frameChannel = store->self;
i = -1;
do {
TimeValue frameDuration;
err = SGGetNextExtendedFrameReference(store->grabber, &fi,
&frameDuration, &i);
if (err) {
if (err == paramErr)
err = noErr;
break;
}
// switch to the next data reference
if (lastOutput != fi.frameOutput) {
err = SGAddOutputDataRefToMedia(store->grabber,
fi.frameOutput, aMedia, sampleDescription);
if (err) goto exit;
lastOutput = fi.frameOutput;
}
//note that only the low 32 bits of the file offset are used here
err = AddMediaSampleReference(aMedia,
fi.frameOffset.lo, fi.frameSize,
frameDuration,
sampleDescription, 1,
0, 0);
} while (err == noErr);
exit:
if (alias) DisposeHandle((Handle)alias);
return err;
In this example, the default data reference is not defined when NewTrackMedia is called. Instead, the default data reference is defined by the first call to SGAddOutputDataRefToMedia . This approach provides added flexibility by allowing movies to be captured to data handlers other than the standard file system data handler.